<template>
  <div>
    <div>
      <van-nav-bar title="薄青影票" fixed placeholder @click-left="onClickLeft">
        <template #left
          ><van-icon name="arrow-left" color="#323233" size="1.5rem"
        /></template>
      </van-nav-bar>
      <div>
        <div class="list-item">
          <div class="list-item-left">
            <van-image fit="cover" :src="baseURL + this.movieInfo.poster"/>
          </div>
          <div class="list-item-center">
            <div class="title">{{this.movieInfo.name}}</div>
            <div>类型：{{this.movieInfo.type}}</div>
            <div class="rate">
              
              <div class="rate-text">{{this.movieInfo.score}}分</div>
            </div>
            <div>导演：{{this.movieInfo.director}}</div>
            <div class="actor">演员：{{this.movieInfo.actor}}</div>
          </div>
        </div>
      </div>

      <div class="list">
        <cinema-list
          v-for="item in cinemaList.slice(0, 5)"
          :key="item.id"
          :cinema="item"
          :movieID="movieId"
        ></cinema-list>
      </div>
      <div class="kbox"></div>
    </div>
  </div>
</template>

<script>
import CinemaList from "@/components/cinema_list.vue";
export default {
  // props: ["id"],
  components: {
    "cinema-list": CinemaList,
  },
  data() {
    return {
      text: 1,
      baseURL:"http://10.36.4.254:8080/",
      cinemaList: [],
      movieId: this.$route.query.movieId,
      movieInfo:[],
      starScore:0,
    };
  },

  mounted() {
    this.axios
      .get(`http://10.36.4.254:8080/cinema/selectCinemaAll`)
      .then((res) => {
        console.log(res);
        this.cinemaList = res.data;
      });
    this.axios.get(`http://10.36.4.254:8080/select/FilmInfoById?id=${this.movieId}`)
    .then((res) => {
      console.log(res)
      this.movieInfo = res.data.data
    })


    // this.starScore = Math.ceil(this.movieInfo.score/2)
    // console.log(this.starScore)

    
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="scss" scoped>
.list-item {
  margin-bottom: 2rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  display: flex;
  width: 100%;
  height: 48vw;
  background-color: #252730;
  border-radius: 0.3rem;
  &:not(:last-child) {
    margin-bottom: 0.5rem;
  }
  > .list-item-left {
    width: 33vw;
    // background-color: skyblue;
    overflow: hidden;
    border-radius: 0.3rem;
  }
  > .list-item-center {
    > .title {
      color: #eee2e2;
      font-weight: 700;
    }

    display: flex;
    flex-flow: column nowrap;
    justify-content: space-evenly;
    width: 50vw;
    color: #858585;
    // background-color: rgb(255, 203, 136);
    padding: 0 0.5rem;
    //!!这里是从未遇见过的feature!! 解决 flex white-space: nowrap,撑大盒子的问题
    min-width: 0;
  }
  > .list-item-right {
    // background-color: aqua;
    color: #fff;
    width: 25vw;
    display: flex;
    justify-content: center;
    align-items: center;
    > button {
      border: none;
      height: 1.7rem;
      line-height: 1.7rem;
      padding: 0 0.7rem;
      background-color: #79bd90;
      border-radius: 1.7rem;
    }
  }
}
.actor {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.rate {
  display: flex;
  align-items: center;
  > .rate-text {
    margin-left: 1.4vw;
    color: #79bd90;
  }
}
@media (min-width: 600px) {
  .rate > .rate-text {
    margin-left: 8.4px;
  }
}
@media (min-width: 768px) {
  .list-item > .list-item-left {
    width: 109px;
  }
  .list-item > .list-item-center {
    width: 371.4px;
  }
  .list-item > .list-item-right {
    width: 177.7px;
  }
}
</style>